package com.example.chapter04;

/**
 * @author myh
 * @date 2024/4/29
 */
public class RangeMethods {
    public static int[] range(int end) {

        int size = end ;
        int[] result = new int[size];
        for(int i = 0; i < size; i++){
            result[i] = i;
        }
        return result;
    }
    public static int[] range(int start, int end) {

        int size = (end - start) ;
        int[] result = new int[size];
        for(int i = 0; i < size; i++){
            result[i] = start+i;
        }
        return result;
    }
    public static int[] range(int start, int end, int step) {

        int size = (end - start + step ) / step;
        int[] result = new int[size];
        for(int i = 0; i < size; i++){
            result[i] = start;
            start += step;
        }
        return result;
    }
}
